package cn.buk.tms.eotms.service;


import cn.buk.common.JsonResult;
import cn.buk.common.sc.CommonSearchCriteria;
import cn.buk.tms.eotms.dto.DtoLoginStatus;
import cn.buk.tms.eotms.dto.base.UserProfileDto;
import cn.buk.tms.eotms.entity.AmountHistory;
import cn.buk.tms.eotms.entity.RolePrivilege;
import cn.buk.tms.eotms.entity.User;
import cn.buk.tms.eotms.entity.UserBindWeixin;

import java.util.List;
import java.util.Optional;
import java.util.Set;

/**
 * @author yfdai
 */
public interface UserService {

	User getUserByUsername(String username);

	UserProfileDto getUserProfile(int userId);

  List<RolePrivilege> searchPrivileges(int enterpriseId, int userId);

  void saveToken(DtoLoginStatus jsonResult);

  Optional<DtoLoginStatus> getLoginStatusByUserId(final int userId);

  JsonResult recharge(int userId, double amount);

  Set<String> loadRolesByUserId(int enterpriseId, int userId);

  /**
   * 查找交易记录
   * @param userId
   * @param sc
   * @return
   */
  List<AmountHistory> searchTransHistory(int userId, CommonSearchCriteria sc);

  /**
   * 将用户名和微信公众号绑定
   * @param ownerId
   * @param username
   * @param openid
   * @param enterpriseId
   * @param userId
   */
  void createUserBindWeixin(int ownerId, String username, String openid, int enterpriseId, int userId);

  UserBindWeixin getUserByOpenid(int ownerId, String openid);

  User getUserById(int userId);


  /**
   * 获取指定用户是否可开GP票
   */
  int getGpMode(int userId);
}
